home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / bmp2imc.zip / DEMO.C < prev    next >
Text File  |  1994-02-20  |  3KB  |  115 lines

  1. /*    While compiling, Dont forget to include the *.lib
  2.     In the command line compiler,
  3.     type tcc -ms demo.c imcs.lib
  4.     since this program is written in small model!    */
  5.  
  6.  
  7. /*    Programmed by Leung Ka Wai    */
  8.  
  9. /*    If you have any comments or opinions,
  10.     dont hesitate to e-mail to me
  11.     or give message to me in BBS
  12.  
  13.     e-mail : kwleung2@se.cuhk.hk    */
  14.  
  15.  
  16. #include <graphics.h>
  17. #include <alloc.h>
  18. #include <bios.h>
  19. #define time 299999   /* This is the elapsed time between displaying
  20.                     and erasing an image */
  21.  
  22. extern void* imc(char*);    /* This is the declaration of the showimc function */
  23.                     /* It can be 'extern void far* imc(char*)' for large
  24.                         model  */
  25.  
  26. main()
  27. {    int gd=VGA, gm=VGAMED;
  28.     void* wong[3],*lung[4],*panda;
  29.     int wong_stand=200,lung_stand=200;
  30.     unsigned long x;
  31.  
  32.     /* palette for Mircosoft's paintbrush */
  33.     struct palettetype pal = { {MAXCOLORS},
  34.                       { EGA_BLACK,
  35.                         EGA_RED,
  36.                         EGA_GREEN,
  37.                         EGA_BROWN,
  38.                         EGA_BLUE,
  39.                         EGA_MAGENTA,
  40.                         EGA_CYAN,
  41.                         EGA_DARKGRAY,
  42.                         EGA_LIGHTGRAY,
  43.                         EGA_LIGHTRED,
  44.                         EGA_LIGHTGREEN,
  45.                         EGA_YELLOW,
  46.                         EGA_LIGHTBLUE,
  47.                         EGA_LIGHTMAGENTA,
  48.                         EGA_LIGHTCYAN,
  49.                         EGA_WHITE
  50.                        }
  51.     };
  52.  
  53.     /* The use of showimc function */
  54.     /* Inside the blackets are the filename */
  55.     wong[0]=imc("wong1.imc");
  56.     wong[1]=imc("wong3.imc");
  57.     wong[2]=imc("wong2.imc");
  58.     lung[0]=imc("lung1.imc");
  59.     lung[1]=imc("lung2.imc");
  60.     lung[2]=imc("lung3.imc");
  61.     lung[3]=imc("lung4.imc");
  62.     panda=imc("panda.imc");
  63.  
  64.     initgraph(&gd,&gm,"");
  65.     setallpalette(&pal);
  66.     putimage(220,50,panda,COPY_PUT);
  67.     while(bioskey(1)==0)
  68.     {    putimage(100,wong_stand,wong[1],COPY_PUT);
  69.         putimage(450,lung_stand,lung[0],COPY_PUT);
  70.         for(x=0;x<time;x++);
  71.         putimage(100,wong_stand,wong[1],XOR_PUT);
  72.         putimage(450,lung_stand,lung[0],XOR_PUT);
  73.  
  74.         putimage(100,wong_stand-50,wong[0],COPY_PUT);
  75.         putimage(450,lung_stand,lung[3],COPY_PUT);
  76.         for(x=0;x<time;x++);
  77.         putimage(100,wong_stand-50,wong[0],XOR_PUT);
  78.         putimage(450,lung_stand,lung[3],XOR_PUT);
  79.  
  80.         putimage(100,wong_stand-70,wong[0],COPY_PUT);
  81.         putimage(450,lung_stand,lung[1],COPY_PUT);
  82.         for(x=0;x<time;x++);
  83.         putimage(100,wong_stand-70,wong[0],XOR_PUT);
  84.         putimage(450,lung_stand,lung[1],XOR_PUT);
  85.  
  86.         putimage(100,wong_stand-40,wong[2],COPY_PUT);
  87.         putimage(465,lung_stand-20,lung[2],COPY_PUT);
  88.         for(x=0;x<time;x++);
  89.         putimage(100,wong_stand-40,wong[2],XOR_PUT);
  90.         putimage(465,lung_stand-20,lung[2],XOR_PUT);
  91.  
  92.         putimage(100,wong_stand-10,wong[2],COPY_PUT);
  93.         putimage(450,lung_stand,lung[0],COPY_PUT);
  94.         for(x=0;x<time;x++);
  95.         putimage(100,wong_stand-10,wong[2],XOR_PUT);
  96.         putimage(450,lung_stand,lung[0],XOR_PUT);
  97.  
  98.         putimage(100,wong_stand,wong[1],COPY_PUT);
  99.         putimage(450,lung_stand,lung[0],COPY_PUT);
  100.         for(x=0;x<time;x++);
  101.         putimage(100,wong_stand,wong[1],XOR_PUT);
  102.         putimage(450,lung_stand,lung[0],XOR_PUT);
  103.     }
  104.     closegraph();
  105.     free(wong[0]);
  106.     free(wong[1]);
  107.     free(wong[2]);
  108.     free(lung[0]);
  109.     free(lung[1]);
  110.     free(lung[2]);
  111.     free(lung[3]);
  112. }
  113.  
  114.  
  115.